package com.ssm.serviceimp;

import com.ssm.dao.IBookDao;
import com.ssm.model.Book;
import com.ssm.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("bookService")
public class BookServiceImp implements BookService {

    @Autowired
    private IBookDao bookDao;

    @Override
    public List<Book> selectAllBook() {
        return bookDao.selectAllBook();
    }

    @Override
    public List<Book> selectBookByName(String name)
    {
        return  bookDao.selectBookByName(name);
    }

    @Override
    public List<Book> selectBookByType(String type)
    {
        return bookDao.selectBookByType(type);
    }

    @Override
    public List<Book> selectBookByAuthor(String author)
    {
        return bookDao.selectBookByAuthor(author);
    }

    @Override
    public Book selectBookByBook_id(String book_id)
    {
        return bookDao.selectBookByBook_id(book_id);
    }

    @Override
    public void addBook(Book book)
    {
        bookDao.addBook(book);
    }

    @Override
    public void updateBook(Book book)
    {
        bookDao.updateBook(book);
    }

    @Override
    public void deleteBook(String book_id)
    {
        bookDao.deleteBook(book_id);
    }

    @Override
    public void decreaseQuantity(String book_id, int cnt) {bookDao.decreaseQuantity(book_id, cnt);}

}
